<template>
    <div class="layer">
        <!-- 公共头部 -->
        <div class="header-layer tp-clear">
            <div class="logo">
                <img src="http://sharedbk.com/logo.png" alt="">
            </div>
            <div class="header-right">
                <div class="message">
                    <span class="iconfont icon-xiaoxi"></span>
                </div>
                <div class="user-layer">
                    <div class="user-info">
                        <img src="https://q2.qlogo.cn/headimg_dl?dst_uin=344225443&spec=100" alt="">
                        <p>鹏仔</p>
                    </div>
                </div>
            </div>
        </div>
        <div class="container-layer">
            <!-- 左侧导航菜单 -->
            <div class="left-layer">
                <div class="nav-menu" :class="isCollapse ? '' : 'menu-shrink'">
                    <navMenu :menuList="menuList"></navMenu>
                </div>
                <div class="an-shrink f-c-c" :class="isCollapse ? 'an' : 'shrink'" @click="isCollapse = !isCollapse">
                    <i :class="isCollapse ? 'el-icon-arrow-left' : 'el-icon-arrow-right'"></i>
                </div>
            </div>
            <!-- 内容部分 -->
            <div class="right-layer" :class="isCollapse ? '' : 'right-shrink'">
                <!-- 面包屑 -->
                <div class="breadcrumb f-a-c">
                    <span>当前位置：</span>
                    <el-breadcrumb separator-class="el-icon-arrow-right">
                        <el-breadcrumb-item :to="{ path: '/' }">首页</el-breadcrumb-item>
                        <!-- <el-breadcrumb-item v-for="(item,index) in breadcrumb" :key="index" :to="{ path: item.path }">{{item.title}}</el-breadcrumb-item> -->
                        <!-- <el-breadcrumb-item v-if="$route.meta.title !='首页'" :to="{ path: $route.meta.path }">{{$route.meta.title}}</el-breadcrumb-item> -->
                    </el-breadcrumb>
                </div>
                <div class="content-layer">
                    <!-- 内容 -->
                    <router-view class="main-wapper"></router-view>
                </div>
            </div>
        </div>

        <!-- <el-container>
            <el-header>
            </el-header>

            <el-container>
                <el-aside width="200px">Aside</el-aside>
                <el-container>
                    <el-main>
                        <router-view class="main-wapper"></router-view>
                    </el-main>
                    <el-footer>Footer</el-footer>
                </el-container>
            </el-container>
        </el-container> -->
    
    </div>
</template>

<script>
import navMenu from "../../components/navMenu.vue";
import publicData from "@A/mixins/publicData";
export default {
  name: "layout",
  mixins: [ publicData ],
  components: {
    navMenu
  },
  data() {
    return {
        isCollapse: true,
        breadcrumb: [],
        menuList: [
            {
                title: '首页',
                path: 'home',
                icon: 'el-icon-s-home',
            },
            {
                title: '爷爷2',
                path: 'b',
                icon: 'el-icon-s-grid',
            },
            {
                title: '爷爷3',
                icon: 'el-icon-s-data',
                children:[
                    {
                        title: '用户列表',
                        path: 'userList'
                    },
                    {
                        title: '儿子2',
                        children:[
                            {
                                title: '孙子1',
                                path: 'a'
                            },
                            {
                                title: '孙子2',
                                path: 'c'
                            },
                            {
                                title: '孙子3',
                                path: 'd'
                            }
                        ]
                    },
                    {
                        title: '儿子3',
                        path: 'e'
                    }
                ]
            },
        ]


    };
  },
  mounted() {
  },
  methods: {
  },
  watch: {},
};
</script>

<style lang="scss" scoped>
.layer {
    width: 100%;
    height: 100%;
    .header-layer{
        width: 100%;
        height: 88px;
        background: #fff;
        border-bottom: 1px solid rgba(0,0,0,.05);
        padding: 12px 20px;
        box-sizing: border-box;
        .logo{
            float: left;
            width: 200px;
            height: 100%;
            display: flex;
            align-items: center;
            justify-content: center;
            img{
                max-width: 100%;
                max-height: 100%;
            }
        }
        .header-right{
            height: 100%;
            float: right;
            display: flex;
            align-items: center;
            .message{
                span{
                    font-size: 24px;
                    cursor: pointer;
                }
            }
            .user-layer{
                height: 100%;
                display: flex;
                align-items: center;
                margin-left: 15px;
                .user-info{
                    display: flex;
                    align-items: center;
                    cursor: pointer;
                    img{
                        width: 30px;
                        height: 30px;
                        border-radius: 50%;
                    }
                    p{
                        color: #000;
                        font-size: 16px;
                        font-weight: 600;
                        padding-left: 8px;
                        box-sizing: border-box;
                    }
                }
            }
        }
    }
    .container-layer{
        width: 100%;
        height: calc(100% - 88px);
        // display: flex;
        position: relative;
        .left-layer{
            height: 100%;
            background: rgba(0,0,0,.9);
            // flex-shrink: 0;
            position: absolute;
            left: 0;
            top: 0;
            .nav-menu{
                width: 200px;
                height: 100%;
                overflow: hidden;
                overflow-y: scroll;
                transition: all .3s;
            }
            .menu-shrink{
                width: 0;
                transition: all .3s;
            }
            .an-shrink{
                font-size: 14px;
                width: 20px;
                height: 60px;
                position: absolute;
                top: 50%;
                margin-top: -30px;
                cursor: pointer;
            }
            .an{
                display: none;
                color: #000;
                background: rgba(255,255,255,.6);
                right: 0;
                border-radius: 10px 0 0 10px;
            }
            &:hover .an{
                display: flex;
            }
            .shrink{
                color: #fff;
                background: rgba(0,0,0,.6);
                right: -20px;
                border-radius: 0 10px 10px 0;
            }
        }
        .right-layer{
            width: 100%;
            height: 100%;
            background: rgba(0,0,0,.05);
            padding: 20px;
            padding-left: 220px;
            box-sizing: border-box;
            transition: all .3s;
            .breadcrumb{
                width: 100%;
                padding: 0 0 10px;
                box-sizing: border-box;
            }
            .content-layer{
                width: 100%;
                height: calc(100% - 30px);
                background: #fff;
                box-shadow: 5px 9px 17px rgba(102,102,102,.4);
                padding: 12px;
                box-sizing: border-box;
                overflow: hidden;
                overflow-y: scroll;
            }
        }
        .right-shrink{
            padding-left: 20px;
            transition: all .3s;
        }
    }
}
</style>